﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using S.Archives.Api.Application.Command.Wander;
using S.Archives.Domain.S.ArchivesDto;
using S.Archives.Domain.S.ArchivesModel;
using System.Reflection;

namespace S.Archives.Api.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class WanderController : ControllerBase
    {
        private IMediator mediator;
        public WanderController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 新增流转
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        /// 
        [HttpPost("WanderCreate")]
        public async Task<IActionResult>  WanderCreate(WanderCreateCommand t)
        {
            var restlt= await  mediator.Send(t);
            return Ok(restlt);
        }
       /// <summary>
       /// 批量添加流转表
       /// </summary>
       /// <param name="Wander"></param>
       /// <returns></returns>
        [HttpPost("WanderCreatePL")]
        public async Task<IActionResult> WanderCreatePL(List<WanderModel> Wander)
        {
            var restlt = await mediator.Send(new WanderCreatePLCommand() { WanderModel=Wander});
            return Ok(restlt);
        }
       /// <summary>
       /// 批量修改流转状态
       /// </summary>
       /// <param name="wander"></param>
       /// <returns>bool</returns>
        [HttpPut("WanderStateDynamicEditPL")]
        public async Task<IActionResult> WanderStateDynamicEditPL(List<WanderStateDynamicDto> wander)
        {
            var restlt = await mediator.Send(new WanderStateDynamicEditPLCommand() { Wander= wander });
            return Ok(restlt);
        }


    }
}
